package md.action;

import md.map.GameMap;
import md.settings.Settings;
import gu.ai.Astar;
import gu.common.Arrays;

public class AIController {

	private final static Astar pathfinder = new Astar();
	
	public final static short[] findPath(int fromX, int fromY, int toX, int toY) {
		long time = System.currentTimeMillis();
		int startPoint = GameMap.calculateIndex(fromX, fromY);
		int endPoint = GameMap.calculateIndex(toX, toY);
		short[] path = pathfinder.findPath(GameMap.map, Settings.mapWidth, Settings.mapHeight, startPoint, endPoint);
		System.out.println("Path calculation time = " + (System.currentTimeMillis() - time) + " ms");
		System.out.println(Arrays.toString(path));
		return path;
	}
	
}
